<?php

namespace App\Modules\Authcode;

use App\Modules\AdapterApi;
use App\Services\Authcode\AuthcodeIndex;

/**
 * 验证码应用层
 * Class ApiAuthCode
 * @package App\Modules\Authcode
 */
class ApiAuthCode extends  AdapterApi
{

    public function createAuthCode()
    {
        $data = pick_array($this->postData, ["token", "type", "code_id", "fontSize", "useCurve", "imageH", "imageW", "length"]);
        $data = init_array($data,  ["fontSize" => 25, "useCurve" => 1, "imageH" => 62, "imageW" => 250, "length" => 5]);

        return AuthcodeIndex::Authcode()->createAuthCode($data);
    }

   public function verifyAuthCode()
   {
       $data = pick_array($this->postData, ["token", "type", "code_id", "auth_code"]);
       return AuthcodeIndex::Authcode()->verifyAuthCode($data);
   }

}